﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic;
using System.Text;
using Commons;
using DAL;
using DAL.Enums;
using NUnit.Framework;

namespace Entity.Initial.IValue 
{
    public class AdmInit : Ini
    {

        public override void Clear()
        {
            using (var db = new PizzaDataDataContext())
            {
                db.Adm.DeleteBatch(p => true);
            }
        }



        public override void Run1()
        {
            this.Run();
        }

        public override void Run2()
        {
            
        }

        public override void Run3()
        {
            
        }

        public override void Run4()
        {
            
        }

        public override void Run5()
        {
            
        }

        public override void Run6()
        {
            
        }

        [Test]
        public void Run11()
        {
            this.Run();
            Assert.Inconclusive("初始成功");
        }

        public void Run()
        {
            using (var db = new PizzaDataDataContext())
            {
                db.Adm.InsertAllOnSubmit(InitialValue);
                db.SubmitChanges();
            }
        }
        public List<Adm> InitialValue
        {
            get
            {
                string temp = string.Empty;
                return new List<Adm>()
                           {
                               new Adm()
                                   {
                                       Security_LoginID = ("sa"),
                                       Security_LoginPwd = Util.AdmEncode("sa"),
                                       Name = "我",
                                       Role = emAdmRole.SysManage.Value,
                                       ModifyDate = DateTime.Now,
                                       ColKeys = "",
                                       Wallet = 0m,
                                       AdmDepartID = 1,
                                   },
                               new Adm()
                                   {
                                       Security_LoginID = ("sa1"),
                                       Security_LoginPwd = Util.AdmEncode("sa1"),
                                       Name = "我1",
                                       Role = emAdmRole.Tain.Value,
                                       ModifyDate = DateTime.Now,
                                       ColKeys = "{uo3Xv0I0Hktq}",
                                       AdmDepartID = 1,
                                   },
                               new Adm()
                                   {
                                       Security_LoginID =temp= (Rand.Str_char(8)),
                                       Security_LoginPwd = Util.AdmEncode(temp),
                                       Name = RandomChinese.GetRandomChinese(5),
                                       Role = emAdmRole.Tain.Value,
                                       ModifyDate = DateTime.Now,
                                       ColKeys = "",
                                       AdmDepartID = 2,
                                   },
                               new Adm()
                                   {
                                       Security_LoginID =temp= (Rand.Str_char(8)),
                                       Security_LoginPwd = Util.AdmEncode(temp),
                                       Name = RandomChinese.GetRandomChinese(5),
                                       Role = emAdmRole.Tain.Value,
                                       ModifyDate = DateTime.Now,
                                       ColKeys = "",
                                       AdmDepartID = 2,
                                   },
                               new Adm()
                                   {
                                       Security_LoginID =temp= (Rand.Str_char(8)),
                                       Security_LoginPwd = Util.AdmEncode(temp),
                                       Name = RandomChinese.GetRandomChinese(5),
                                       Role = emAdmRole.Tain.Value,
                                       ModifyDate = DateTime.Now,
                                       ColKeys = "",
                                       AdmDepartID = 1,
                                   },
                               new Adm()
                                   {
                                       Security_LoginID =temp= (Rand.Str_char(8)),
                                       Security_LoginPwd = Util.AdmEncode(temp),
                                       Name = RandomChinese.GetRandomChinese(5),
                                       Role = emAdmRole.Tain.Value,
                                       ModifyDate = DateTime.Now,
                                       ColKeys = "",
                                       AdmDepartID = 2,
                                   },
                           };
            }
        }

    }
}
